package javase.设计模式.代理模式;

import javase.设计模式.代理模式.impl.BuyHouseImpl;

import java.lang.reflect.Proxy;

public class TestProxy {

    public static void main(String[] args) {
        BuyHouse buyHouse = new BuyHouseImpl();
        BuyHouse proxyBuyHouse = (BuyHouse) Proxy.newProxyInstance(BuyHouse.class.getClassLoader(), new
                Class[]{BuyHouse.class}, new DynamicProxyHandler(buyHouse));
        proxyBuyHouse.buy();
    }

}
